package com.ruoyi.notes.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.notes.domain.MyNote;
import com.ruoyi.notes.mapper.MyNoteMapper;
import com.ruoyi.notes.service.IMyNoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 	个人笔记Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-09-20
 */
@Service
public class MyNoteServiceImpl implements IMyNoteService {
	@Autowired
	private MyNoteMapper myNoteMapper;

	/**
	 * 	查询个人笔记
	 * 
	 * @param id 个人笔记主键
	 * @return 个人笔记
	 */
	@Override
	public MyNote selectMyNoteById(Long id) {
		return myNoteMapper.selectMyNoteById(id);
	}

	/**
	 * 查询个人笔记列表
	 * 
	 * @param myNote 个人笔记
	 * @return 个人笔记
	 */
	@Override
	public List<MyNote> selectMyNoteList(MyNote myNote) {
		return myNoteMapper.selectMyNoteList(myNote);
	}

	/**
	 * 新增个人笔记
	 * 
	 * @param myNote 个人笔记
	 * @return 结果
	 */
	@Override
	public int insertMyNote(MyNote myNote) {
		myNote.setCreateTime(DateUtils.getNowDate());
		return myNoteMapper.insertMyNote(myNote);
	}

	/**
	 * 修改个人笔记
	 * 
	 * @param myNote 个人笔记
	 * @return 结果
	 */
	@Override
	public int updateMyNote(MyNote myNote) {
		myNote.setUpdateTime(DateUtils.getNowDate());
		return myNoteMapper.updateMyNote(myNote);
	}

	/**
	 * 批量删除个人笔记
	 * 
	 * @param ids 需要删除的个人笔记主键
	 * @return 结果
	 */
	@Override
	public int deleteMyNoteByIds(Long[] ids) {
		return myNoteMapper.deleteMyNoteByIds(ids);
	}

	/**
	 * 删除个人笔记信息
	 * 
	 * @param id 个人笔记主键
	 * @return 结果
	 */
	@Override
	public int deleteMyNoteById(Long id) {
		return myNoteMapper.deleteMyNoteById(id);
	}
}
